<?php

namespace App\Http\Requests\Api\v1;

use App\Models\Configuration;

class CardRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        $number_rule = $this->method() == 'POST' ? '$selfId' : $this->route('card')->id;
        return [
            'number' => 'required|confirmed|regex:/(^[A-Za-z0-9-_]+$)+/|unique:App\Models\Card,number,' . $number_rule . ',id,deleted_at,NULL',
            'number_confirmation' => 'required|same:number',
            'username' => 'required',
            //'password'=> 'required',
            //'phone' => 'required',
            //'email' => 'required',
            //'ifsc' => 'regex:/^[A-Za-z0-9]{4}0[A-Za-z0-9]{6}$/',
            //'verification_key' => 'required',
            //'verification_code' => 'numeric',
        ];
    }

}
